<?php
// +----------------------------------------------------------------------
// | CatchAdmin [Just Like ～ ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2020 http://catchadmin.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
// +----------------------------------------------------------------------
// | Author: JaguarJack [ njphper@gmail.com ]
// +----------------------------------------------------------------------
namespace catchAdmin\sms\model\search;

trait SmsRecordSearch
{
    public function searchSourceAttr($query, $value, $data)
    {
        return $query->where('source', $value);
    }

    public function searchStatusAttr($query, $value, $data)
    {
        return $query->where('status', (int)$value);
    }

    public function searchPatientNameAttr($query, $value, $data)
    {
        return $query->where('patientName', 'like', $value);
    }

    public function searchTelephoneAttr($query, $value, $data)
    {
        return $query->where('telephone', "like", $value);
    }

    public function searchCreateAtAttr($query, $value, $data)
    {
        return $query->whereTime($this->aliasField('created_at'), 'between', $value);
    }
}